ARDK for Android/com.nianticlabs.ardk.objectdetection/transformed
transformed
[androidJvm]
fun DetectedObject.transformed(display: Matrix?, reprojection: Matrix? = null, containerSize: Size, viewportSize: Size): DetectedObject
Transforms this DetectedObject's bounding box from model space into viewport space, using optional reprojection and display matrices.
The transformation happens in two stages:
- reprojection — (optional) applies a full 3×3 projective homography to reproject bounding box coordinates from the camera pose at detection time to the current frame pose.
- display — (optional) applies a 2D affine transformation to map normalized coordinates from model space into the screen's coordinate system (e.g. scale and offset into the viewport).
Return
A new DetectedObject with transformed pixel-space coordinates.
Parameters
androidJvm
| display | An optional affine Matrix that maps normalized model-space coordinates into the screen or viewport coordinate system. |
| reprojection | An optional projective Matrix that reprojects coordinates to match the current camera pose, compensating for camera motion since detection. |
| containerSize | The size of the model's input frame (used to normalize the bounding box). |
| viewportSize | The size of the current screen or viewport (used to scale up to pixels). |